package utils;

public class CreateArr {
    public static int[] createRandomInt(int number, int min, int max) {
        if (max < min) {
            int temp = min;
            min = max;
            max = temp;
        }
        int[] arr = new int[number];

        for (int i = 0; i < number; i++) {
            arr[i] = (int) (Math.random() * (max - min) + min);
        }

        /*打印原数组*/
        System.out.print("原数组 :　");
        for (int i = 0; i < number; i++) {
            System.out.print(arr[i] + " ");
        }
        return arr;
    }

    public static int[] createSortInt(int number, int min, int step) {
        int[] arr = new int[number];
        arr[0] = min;
        for (int i = 1; i < number; i++) {
            arr[i] = min + step;
            min += step;
        }
        return arr;
    }
}
